#!/opt/local/bin/perl
use strict;
use warnings;
use LastFM::API;

my $musicDir=shift || die "USAGE: ./get_album_art.pl MUSIC_DIR\n";

my ($dataBase,$allTags) = getTagDatabase($musicDir);
my $albums = getAlbums($dataBase);

foreach my $artist (keys %$albums){
  foreach my $album (keys %{$$albums{$artist}}){
    my $art_url=get_cover_art_url($artist,$album) || next;
    my $file=$$albums{$artist}{$album}."/cover.jpg";
    save_url($art_url,$file);
  }
}



